Skip to content

Add request context source ledger#95

Merged
cbusillo merged 2 commits into
local/cbusillo-overlayfrom
feat/context-source-ledger
May 22, 2026
Merged

Add request context source ledger#95
cbusillo merged 2 commits into
local/cbusillo-overlayfrom
feat/context-source-ledger

Conversation

@cbusillo
Copy link
Copy Markdown
Owner

Summary

Adds the first #92 context observability slice:

  • introduces a core ContextLedger with source kind, persistence class, labels, item count, byte estimate, approximate token estimate, and duplicate keys
  • computes the ledger from the final formatted Responses request input, plus base instructions and tool schemas
  • logs a compact ledger summary and detailed entries through code_core::context_ledger before Responses requests are sent
  • splits project/user instructions from the rendered skills manifest so future /context views can show skill catalog cost separately
  • classifies explicit $skill injections as request-only context
  • adds fake Responses harness coverage proving the executable path logs ledger categories while the actual request body contains the expected project docs, implicit skills catalog, and explicit manual skill body

Refs #92, #93.

Validation

  • cargo test -p code-core client_common::tests::context_ledger
  • cargo test -p code-core --test prompt_context_dedup
  • python3 tools/code-exec-harness/harness.py tools/code-exec-harness/scenarios/context-ledger-request-summary.json --code-bin /Users/cbusillo/Developer/code/code-rs/target/debug/code
  • ./build-fast.sh
  • python3 tools/code-exec-harness/harness.py tools/code-exec-harness/scenarios/context-ledger-request-summary.json --code-bin /Users/cbusillo/Developer/code/.code/working/_target-cache/code/feat-context-source-ledger-be2596d583c8-2af88e04f956/code-rs/dev-fast/code

Base automatically changed from docs/code-exec-harness-guidance to local/cbusillo-overlay May 22, 2026 22:01
@cbusillo cbusillo merged commit 11cfb67 into local/cbusillo-overlay May 22, 2026
1 check passed
@cbusillo cbusillo deleted the feat/context-source-ledger branch May 22, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant